package com.sigmatrix.h5.web.ins.controller;

import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sigmatrix.h5.entity.DisDealer;
import com.sigmatrix.h5.service.DisDealerService;
import com.sigmatrix.h5.web.BaseController;
import com.sigmatrix.h5.web.Result;
import com.sigmatrix.h5.web.args.DealerPageParam;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags={"经销商"})
@RestController
@RequestMapping("/ins/dealer")
public class DistributionDealerController extends BaseController{
	
	@Autowired
	DisDealerService service;
	
	/**
	 * 
	 *@Title: list
	 *@Description: 查询所有经销商
	 *@return Result
	 *@author MH
	 *@date 2017年9月29日 下午1:32:32
	 *@return
	 */
	@ApiOperation("查询所有")
	@PostMapping("list")
	public Result<List<DisDealer>> list(@RequestBody DealerPageParam vo){
		DisDealer dealer = new DisDealer();
		BeanUtils.copyProperties(vo, dealer);
		List<DisDealer> list = service.select(dealer,vo.getPageNo(),vo.getPageSize());
		//if(CommonUtils.isEmpty(list))return error("获取经销商失败");
		return ok(list);
	}
}
